package ws.jdbc.concurrent.driver.sqlserver.cursor.shared

import junit.framework.*
import ws.jdbc.concurrent.driver.sqlserver.*

/**
 * Test case of CursorForwardOnlyReadOnly class methods.
 * 
 * @author Wilson Santos, 36228 <wilson.santos@ua.pt>
 */
class CursorForwardOnlyReadOnlyTest extends ForwardOnlyReadOnlyTest {

  /**
   * Run this before every test.
   */
  @Override
  void setUp() {
    super.setUp()

    stmt = con.createStatement()
    stmt.setFetchSize(0)
    stmt.executeQuery(sqlQuery)
    rs = stmt.getCursor()

    assertNotNull rs
    assertTrue rs instanceof CursorForwardOnlyReadOnly
  }

  /**
   * Test next() for multiple threads.
   */
  void testNextTheads() {
    println "testNextThreads()"

    runThreads {
      super.testNext(stmt.getCursor())
    }
  }

  /**
   * Test next() loop for multiple threads.
   */
  void testNextLoopTheads() {
    println "testNextLoopThreads()"

    runThreads {
      super.testNextLoop(stmt.getCursor())
    }
  }

//  public static Test suite() {
//    TestSuite suite = new TestSuite()
//
//    suite.addTest(suite.createTest(CursorForwardOnlyReadOnlyTest.class, "testNextLoop"))
//
//    return suite
//  }
}